{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1fd19a0b-0334-4d19-a092-a81950ce12ab",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-06-29T03:44:40.786806Z",
     "iopub.status.busy": "2022-06-29T03:44:40.786569Z",
     "iopub.status.idle": "2022-06-29T03:44:41.398666Z",
     "shell.execute_reply": "2022-06-29T03:44:41.398149Z",
     "shell.execute_reply.started": "2022-06-29T03:44:40.786757Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "# 导入包\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "28d8421c-36e8-4e0e-be77-920f445bac20",
   "metadata": {},
   "source": [
    "```python\n",
    "plt.hist(x, bins, range, density, cumulative, ...)\n",
    "```\n",
    "### 参数解释\n",
    "* x: 一组数据，直方图会对这组数据进行分组\n",
    "* bins: 分组信息，以数字或序列的形式出现。\n",
    "    * 如果bins是数字：会按照该数字自动对数据x进行分组\n",
    "    * 如果bins是序列：会按照序列定义的区间对数据x进行分组\n",
    "* range，指定划分区间的最大值和最小值（用得不多）\n",
    "    * 如果手动指定了bins，则无效\n",
    "* density: 密度，把数量统计改成频率的密度统计\n",
    "    * 频率的密度统计 = (区间的数量统计/总数据量)/区间长度\n",
    "    * 默认是False\n",
    "* cumulative: 统计值进行累加（用得不多）\n",
    "\n",
    "### 返回值\n",
    "* n: 每个bin中数据的个数，以数组形式出现\n",
    "    * 如果设定了density，就是bin里的密度统计\n",
    "* bins: bins的分组区间，以数组形式出现\n",
    "* patches: 每个柱面对象，以数组形式出现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f3baf745-8d01-4f39-af4e-18b89e31a61b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-06-29T03:44:43.783560Z",
     "iopub.status.busy": "2022-06-29T03:44:43.783149Z",
     "iopub.status.idle": "2022-06-29T03:44:43.793858Z",
     "shell.execute_reply": "2022-06-29T03:44:43.792719Z",
     "shell.execute_reply.started": "2022-06-29T03:44:43.783535Z"
    },
    "tags": []
   },
   "outputs": [],
   "source": [
    "# 创建实验数据\n",
    "data = [131,  98, 125, 131, 124, 139, 131, 117, 128, 108, 135, 138, 131, 102, 107, 114, 119, 128, 121, 142, 127, 130, 124, 101, 110, 116, 117, 110, 128, 128, 115,  99, 136, 126, 134,  95, 138, 117, 111,78, 132, 124, 113, 150, 110, 117,  86,  95, 144, 105, 126, 130,126, 130, 126, 116, 123, 106, 112, 138, 123,  86, 101,  99, 136,123, 117, 119, 105, 137, 123, 128, 125, 104, 109, 134, 125, 127,105, 120, 107, 129, 116, 108, 132, 103, 136, 118, 102, 120, 114,105, 115, 132, 145, 119, 121, 112, 139, 125, 138, 109, 132, 134,156, 106, 117, 127, 144, 139, 139, 119, 140,  83, 110, 102,123,107, 143, 115, 136, 118, 139, 123, 112, 118, 125, 109, 119, 133,112, 114, 122, 109, 106, 123, 116, 131, 127, 115, 118, 112, 135,115, 146, 137, 116, 103, 144,  83, 123, 111, 110, 111, 100, 154,136, 100, 118, 119, 133, 134, 106, 129, 126, 110, 111, 109, 141,120, 117, 106, 149, 122, 122, 110, 118, 127, 121, 114, 125, 126,114, 140, 103, 130, 141, 117, 106, 114, 121, 114, 133, 137,  92,121, 112, 146,  97, 137, 105,  98, 117, 112,  81,  97, 139, 113,134, 106, 144, 110, 137, 137, 111, 104, 117, 100, 111, 101, 110,105, 129, 137, 112, 120, 113, 133, 112,  83,  94, 146, 133, 101,131, 116, 111,  84, 137, 115, 122, 106, 144, 109, 123, 116, 111,111, 133, 150]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51f36fa1-da30-46b5-b4bf-b60f627ca0db",
   "metadata": {
    "tags": []
   },
   "source": [
    "## 一、自动分组"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "10f03ac6-4456-42f2-94fe-e159dfe0c4d8",
   "metadata": {
    "tags": []
   },
   "source": [
    "### 1.1 基础操作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7b026bb8-ab68-4bd4-85eb-f80e2772a1b4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-06-29T03:44:52.386293Z",
     "iopub.status.busy": "2022-06-29T03:44:52.385970Z",
     "iopub.status.idle": "2022-06-29T03:44:52.584212Z",
     "shell.execute_reply": "2022-06-29T03:44:52.583280Z",
     "shell.execute_reply.started": "2022-06-29T03:44:52.386267Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 2.  4.  2.  1.  5. 11. 14. 19. 30. 20. 26. 21. 22. 17. 18. 20.  9.  4.\n",
      "  3.  2.]\n",
      "[ 78.   81.9  85.8  89.7  93.6  97.5 101.4 105.3 109.2 113.1 117.  120.9\n",
      " 124.8 128.7 132.6 136.5 140.4 144.3 148.2 152.1 156. ]\n",
      "<BarContainer object of 20 artists>\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA2cAAAEvCAYAAADB37lNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAcmklEQVR4nO3dfbBkZ10n8O/PTHiLKMFMYMhkMoEKlNGVgGNkF0EkooHKEliLXRDZbIkV3RKXsL4kiOVCWbtFEMQ/3MKKEkm5vIgKS8yySkyprK5GJzEJMxuQF5PMDDPJgOUiugtJePaPPuNe7nTf7r63e+4zcz+fqq7bffqc0997ztPP6V+f0+dUay0AAABsrq/Z7AAAAAAozgAAALqgOAMAAOiA4gwAAKADijMAAIAOKM4AAAA6sO1EvthZZ53Vdu/efSJfEgAAoBu33Xbb51pr28c9d0KLs927d2fv3r0n8iUBAAC6UVX3TnrOYY0AAAAdUJwBAAB0QHEGAADQAcUZAABABxRnAAAAHVCcAQAAdEBxBgAA0IGpxVlVPaqq/ryq7qyq/VX1pmH446vq5qr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168Y9h0ZndnsziS3JvnWYfiTknx4xXgvSvJXGX1D+YYFZnpTRm+ofUl+PaOzFb00ozfhl5Lcn+T3JmT6Hxk1rjuTXLKE5TUu269n9NuRuzJqxDsmZDtu2iXneu2wfv4qyZuTf7yo+upcx7WBBeY6bn1kdIanfcPy+p0k50zIdVFGh6TdldEG+8xl5hqGvyuj3wCtHPcfc2X0W7g7h9v+jbb7jIrCw0keHNr3qzM6Y9ItGX2IuyXJ41eMf09Ge/q+OIx/4TD8VzPm7E5Z55kl58mV0beh+4dlcnuSf75iPv+Ya9J6X2Ku3Uk+kdGXIL+fFWchXZXrUxn9tuOO4baeM4qNyzWpz3rVsLzuGJbXSybkGjv9snIN4z8vo5PlrJ7PylwT2+cGc01cDxkdxvTpYX2+cEKusf3dMnOtmO6NWXE2tFW5xm5Pl5UryddmtIduf0Z93E+OyzU8fldW9XcLyDWpf/+ZjPYS37HidvaY5fWIJP9lmMftSZ6/zFzD+D8wLK99Sd4yYT2O3c5vNNeq5+/Jiv46M7T7taZfZrYZ2/5S+vxJuWZt+1lenz/ps+CsbX9Zff7Etjtj299wn7/o27EPswAAAGyirXJYIwAAQNcUZwAAAB1QnAEAAHRAcQYAANABxRkAAEAHFGcAAAAdUJwBAAB0QHEGAADQgf8H0BTQMXwpQr0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1080x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置画板\n",
    "plt.figure(figsize=(15,5))\n",
    "# 设置绘图数据\n",
    "# bins为20，自动分成20组\n",
    "counts,bins,patches = plt.hist(data,20,edgecolor=\"k\")\n",
    "# 查看返回数据，实际操作中可以删去\n",
    "print(counts)\n",
    "print(bins)\n",
    "print(patches)\n",
    "# 设置显示x轴刻度\n",
    "plt.xticks(bins,bins)\n",
    "# 绘图\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ff870e0c-41d3-4ff8-b4df-b1e68c911ef3",
   "metadata": {
    "tags": []
   },
   "source": [
    "### 1.2 加入频率密度统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a5b2c3ff-2407-4167-bf39-7c2958183488",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-06-29T03:44:55.331637Z",
     "iopub.status.busy": "2022-06-29T03:44:55.331184Z",
     "iopub.status.idle": "2022-06-29T03:44:55.520330Z",
     "shell.execute_reply": "2022-06-29T03:44:55.519587Z",
     "shell.execute_reply.started": "2022-06-29T03:44:55.331609Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.00205128 0.00410256 0.00205128 0.00102564 0.00512821 0.01128205\n",
      " 0.01435897 0.01948718 0.03076923 0.02051282 0.02666667 0.02153846\n",
      " 0.0225641  0.0174359  0.01846154 0.02051282 0.00923077 0.00410256\n",
      " 0.00307692 0.00205128]\n",
      "[ 78.   81.9  85.8  89.7  93.6  97.5 101.4 105.3 109.2 113.1 117.  120.9\n",
      " 124.8 128.7 132.6 136.5 140.4 144.3 148.2 152.1 156. ]\n",
      "<BarContainer object of 20 artists>\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA3cAAAEvCAYAAADmcTilAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAiN0lEQVR4nO3df7AlZ3kf+O/jGeQf2IlEGMFYo192jSkr3ljIiqxdx44XTCKpWAY2RVbEAQWTkrUrZY3XjpHtVBaXazdATEioUFKBkS2yjjGxnWVCtAGiiu11NsISWBJShMJYlpgRox/GMY7NroXEs3+cnuRw55x7+86cy73q+/lUnTqnu9+3z9Pd73n7PKf7dFd3BwAAgGe3r9ruAAAAADh9kjsAAIAJkNwBAABMgOQOAABgAiR3AAAAEy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sx3+WVsZ1zD+5zP7D9R82f8cV2b/BbxneNx/uu0+s6TyeJIvDu37DZldser2zL4E3p7keXPlH87sSOMfDeUvGsb/bBZcXSuneGXPzcSV2a+x9w/r5BNJ/ru5+fznuJZt9y2M64IkD2b2I8q/ztxVYNfEdSSz/7bcPTxO5Ypui+Ja1me9dlhfdw/r65VL4lpYf6viGsp/b2YXG1o7n/m4lrbP04xr6XbI7DSs3xm255VL4lrY321lXHP13py5q9GtiWvh/nSr4kry9ZkdIbw/sz7uby+Kaxj++azp71YQ17L+/e9kdpT67rnH2QvW1xlJ/o9hHp9I8pKtjGso/9eH9XVfkrct2Y4L9/OnG9ea6Q9nrr/OiHa/Xv2tjG1k29+SPn9ZXGPbfrauz1/2XXBs29+qPn9p2x3Z9k+7z1/148SXWQAAAJ7FnJYJAAAwAZI7AACACZDcAQAATIDkDgAAYAIkdwAAABMguQMAAJgAyR0AAMAESO4AAAAm4P8HK9HBl+DOKKEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1080x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置画板\n",
    "plt.figure(figsize=(15,5))\n",
    "# 设置绘图数据\n",
    "# bins为20，自动分成20组\n",
    "# 计算频率密度统计\n",
    "counts,bins,patches = plt.hist(data,20,edgecolor=\"k\",density=True)\n",
    "# 查看返回数据，实际操作中可以删去\n",
    "print(counts)\n",
    "print(bins)\n",
    "print(patches)\n",
    "# 设置显示x轴刻度\n",
    "plt.xticks(bins,bins)\n",
    "# 绘图\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aa1bb538-ab2b-4107-b604-281ae012fdd6",
   "metadata": {
    "tags": []
   },
   "source": [
    "### 1.3 加入range设置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "20566945-7979-44f0-90f1-be04929cdf24",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-06-29T03:44:58.301389Z",
     "iopub.status.busy": "2022-06-29T03:44:58.301098Z",
     "iopub.status.idle": "2022-06-29T03:44:58.476735Z",
     "shell.execute_reply": "2022-06-29T03:44:58.475969Z",
     "shell.execute_reply.started": "2022-06-29T03:44:58.301367Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.  7.  4. 19. 45. 54. 42. 35. 29.\n",
      " 12.  2.]\n",
      "[  0.   8.  16.  24.  32.  40.  48.  56.  64.  72.  80.  88.  96. 104.\n",
      " 112. 120. 128. 136. 144. 152. 160.]\n",
      "<BarContainer object of 20 artists>\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA2cAAAEvCAYAAADB37lNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAAZrElEQVR4nO3df7CldX0f8Penu+tvE0EWWFlgsYOO1lGkW0qrsQ1Eg2YHsB07mJhsp2ZoMjEVGyMYOxmdTjtiftlOM8lQtd3GX6X+gm6tQkgwbUbRBQGhaPAHuywu7Gqaqs2MAn77x3k23N69d/feu/ec58u9r9fMmXPOc55zz3ue53uee973ec5zq7UWAAAAxvXXxg4AAACAcgYAANAF5QwAAKADyhkAAEAHlDMAAIAOKGcAAAAd2DjLFzvppJPatm3bZvmSAAAA3bj11lu/1VrbvNBjMy1n27Zty549e2b5kgAAAN2oqr2LPeawRgAAgA4oZwAAAB1QzgAAADqgnAEAAHRAOQMAAOiAcgYAANAB5QwAAKADyhkAAEAHlDMAAIAOKGcAAAAdUM4AAAA6oJwBAKySLVvPSFV1d9my9YyxFw2wBBvHDgAAsFY8+MD9OfPK3WPHOMLeq3eMHQFYAnvOAAAAOqCcAQAAdEA5AwAA6IByBgAA0AHlDAAAoAPKG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3jZM+4UkvzDcriS/Ozz+pcw5E9OUc70jk43CXUn+IJMzy8w8Vya/mA8keTiTDcLrMxnk7x+y3ZbkgmHeZyX55NGW7Srmemkmu6LvTHL7cHnVvHnuy3BGo1llS/LCJF8cct2V5NeH6V/N5Djnw1l/f5a55vz8v5/Hzoj4zCQ3ZfIB8KYkJ46RaZFsL01yayaHVd2S5G/OeD0+e3jtOzL5MvPhbUMPY/+cJHuGMfaJJCeMPe6Hn/2UJN9O8qNzpo0+7rPwtnT0sb9IrlHH/fCz/0cmHzrvSHLhWOM+C//uWXC9zXve2zPn7HGZnGho+3D7mM9fYa5XD7e/n+ShJJ8e5v0XmRx6fPucy8kzzLXg+2+Y/23DevpKhjOEjp0rydMy2WN89zAGf3VauY6S7aPDOL8zyX9Nctqc+V83ZLsrybtmuczmPX5fFj4j79sz+7H/B5l8Br0zk0KzpZOxv+A2a5Zjf7UvNQQDAABgROvpsEYAAIBuKWcAAAAdUM4AAAA6oJwBAAB0QDkDAADogHIGAADQAeUMAACgA8oZAABAB/4f2B02Fpgtg/gAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1080x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置画板\n",
    "plt.figure(figsize=(15,5))\n",
    "# 设置绘图数据\n",
    "# bins为20，自动分成20组\n",
    "# range设定最大值和最小值\n",
    "counts,bins,patches = plt.hist(data,20,range=(0,160),edgecolor=\"k\")\n",
    "# 查看返回数据，实际操作中可以删去\n",
    "print(counts)\n",
    "print(bins)\n",
    "print(patches)\n",
    "# 设置显示x轴刻度\n",
    "plt.xticks(bins,bins)\n",
    "# 绘图\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9721609c-1f82-4e7e-81b0-e9132658647f",
   "metadata": {},
   "source": [
    "## 二、手动分组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1dea03e4-58e6-4ff9-96bf-a3bca07ecc7a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-06-29T03:45:02.249689Z",
     "iopub.status.busy": "2022-06-29T03:45:02.249129Z",
     "iopub.status.idle": "2022-06-29T03:45:02.428530Z",
     "shell.execute_reply": "2022-06-29T03:45:02.427697Z",
     "shell.execute_reply.started": "2022-06-29T03:45:02.249648Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[  8.  13. 113. 116.]\n",
      "[  0  91 101 121 160]\n",
      "<BarContainer object of 4 artists>\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA20AAAEvCAYAAADW/SmEAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAASjklEQVR4nO3dfYxl9V3H8c9X1qLVGEEGXFkomGxV2rRqRlI1NlXUUsUumpDQqNkoSmpqbX2IgI3hryZFjdH4lGwsdtUGQmqVTeNDcatW/6B1sVWhWwT7wC4s7NSmam0Et/36xxztSGdZ994Z7m9mXq9/zj2/e+7cL5fJ7rz3nnumujsAAACM6fMWPQAAAACnJ9oAAAAGJtoAAAAGJtoAAAAGJtoAAAAGJtoAAAAGtutMB1TV7UmuSXKyu184rf1iku9J8lSSf07yQ939iem+W5LckOTTSX6iu//sTM9xwQUX9GWXXTbjfwIAAMDWdt99932su5fWu6/O9HvaquqlST6Z5HfXRNt3JnlXd5+qqtuSpLtvqqorktyR5MokX5Hkz5M8v7s//UzPsby83EeOHDnL/ywAAIDtoaru6+7l9e474+mR3f3uJB9/2to7u/vUtHtvkj3T7X1J7uzuJ7v7w0kezmrAAQAAMION+EzbDyf5k+n2xUmOrbnv+LQGAADADOaKtqp6Q5JTSd76P0vrHLbu+ZdVdWNVHamqIysrK/OMAQAAsG3NHG1VtT+rFyj5/v7sB+OO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fjl2qdRVd+V5FeSnJPk9u5+42InAoD1VdVfJ/myJP+V5Ke6+3BVfW+SX0uylOQTSd7f3UNcyrqq7kjysqz+K/cTSW7N6g9UdyW5NMkjSa7r7o9Px38kyZdk9YesTyT5zu7+wLM89rZwmtf+liTnJvmX6bB7u/vV0/EfideeLeY03+e/l+T2JF+b5KkkP9Pd75qOf0NWP895Ksnru3u4z3WKNgAAgIE5PRIAAGBgog0AAGBgog0AAGBgog0AAGBgog0AAGBgog0AAGBgog0AAGBgog0AAGBg/w2Db9d9Gz0gvgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 1080x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置画板\n",
    "plt.figure(figsize=(15,5))\n",
    "# 设置绘图数据\n",
    "# bins为20，自动分成20组\n",
    "counts,bins,patches = plt.hist(data,[0,91,101,121,160],edgecolor=\"k\")\n",
    "# 查看返回数据，实际操作中可以删去\n",
    "print(counts)\n",
    "print(bins)\n",
    "print(patches)\n",
    "# 设置显示x轴刻度\n",
    "plt.xticks(bins,bins)\n",
    "# 绘图\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
